#!/bin/bash


my_pubkey="ssh-rsa AAAAB3NzaC1yc2EAAAADAQABAAABgQDBxw7mFVz/0ebgWW7RcQ9oYqFUX53/tgDbojZugRcm74BRwMwI1H6MBeTe42tvOG9sKsj0MDLezFdvYdAJOG1mETU9FxPfsVB+qBpl73/HbCgJLDm1w4p1oXVyhMHrOZlafpfVAlp5G4trFWiHg3kXfhfayTGnxnCfsVrXaGwgbrYI7Wn1XV5wKFX+g0pmwySF1UpuN9AHLvOX529Fey8sEoQ8PoogHhApJE5yICyOfOd/kTHiYjiat0mMKpO05Ie7eCK9ag7eKX0C8oKSeg6qhKJpzznfCMzNM+L5zIg7atS4Q1X/lsgIO0Miavl2tVLsV8GH4M6CPr4yeBvzeEvfPQrsMOc/UX+4zxirdM90iXrhCP3G5pDgEfocOo2jJtRH1zkxC55CZpepayCM36JxiMvPDlVE+eADMrrbOoYjC1mMtRlNvmMZWMMnLhQ6a5TNWw3Uvp/DjGq6nIic7jLhvegsqHF7pxvCR+tbJy3YjkiEPAhrodNCAynfgScBsbE= hg_root"

echo "add hg_root pub key...."
mkdir -p ~/.ssh/
if [ ! -e ~/.ssh/authorized_keys ]; then
    touch ~/.ssh/authorized_keys
fi
grep -q "$my_pubkey"  ~/.ssh/authorized_keys || echo "$my_pubkey" >>  ~/.ssh/authorized_keys

chmod 700 ~/.ssh
chmod 600 ~/.ssh/*

# sudo sed -i 's|#MaxAuthTries.*|MaxAuthTries 20|' /etc/ssh/sshd_config
